import { SideBarState } from '#/sideBar'
import { defineStore } from 'pinia'
import { setSidebarStatus, getSidebarStatus } from '@/utils/cookies'


export const sideBarStore = defineStore({
  id: 'app-sideBar',
  state: (): SideBarState => ({
    opened: getSidebarStatus() !== 'closed',
    sidebarTextTheme: '#57CAEB'
  }),
  actions: {
    setOpened(status: boolean) {
      this.opened = status
      setSidebarStatus(status ? 'opened' : 'closed')
    }
  }
})